package com.neu.api.mapper;

import com.neu.api.entity.School;
import com.neu.api.query.SchoolQuery;
import com.neu.api.vo.SchoolVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

//用户数据接口
@Mapper
public interface SchoolMapper {
    /**
     * 用户数据新增
     */
//    @Insert("insert into t_school(name,login_name,password,link_name,link_phone,address) values (#{name},#{loginName},#{password},#{linkName},#{linkPhone},#{address})")
    void addSchool(School school);

    /**
     * 用户数据修改
     */
    @Update("UPDATE `t_school` SET `address` = #{address}, `name` = #{name}, `login_name` = #{loginName}, `link_name` = #{linkName}, `link_phone` = #{linkPhone} WHERE `id` = #{id}")
    void updateSchool(School user);

    /**
     * 用户数据删除
     */
    @Delete("delete from t_school where id=#{id}")
    void deleteSchool(int id);

    /**
     * 根据用户名称查询用户信息
     *
     */
    @Select("SELECT * FROM t_school where id=#{id}")
    School findById(String schoolName);

    /**
     * 查询所有
     */
    @Select("SELECT id,name,login_name,password,link_name,link_phone,status,address FROM t_school")
    List<School> findAll();





//    @Select(" select id,name,login_name,phone,status,create_time,update_time from t_user where login_name=#{loginName} and password = #{password}")
    School login(@Param("loginName") String loginName, @Param("password") String password);

    List<SchoolVO> find(SchoolQuery schoolQuery);

    boolean updateStatus(@Param("id") Integer id,@Param("status") Integer status);
}
